package com.ruoyi.system.domain;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.utils.StringUtils;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;

/**
 * 订单对象 super_orders
 * 
 * @author ruoyi
 * @date 2025-08-14
 */
public class SuperOrders extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /** 订单id */
    private Long id;

    /** 用户id */
    @Excel(name = "用户id")
    private Long userId;

    /** 支付方式代码 */
    @Excel(name = "支付方式代码")
    private Long payId;

    /** 配送方式 */
    @Excel(name = "配送方式")
    private Long deliveryId;

    /*订单下的每种商品总数量*/
    private Integer totalQuantity;

    /** 订单总金额 */
    @Excel(name = "订单总金额")
    private BigDecimal totalAmount;

    /** 订单状态 */
    @Excel(name = "订单状态")
    private Integer status;

    /** 下单时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")  // 加上时分秒，指定时区避免偏差
    @Excel(name = "下单时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")  // Excel导出格式同步更新
    private Date createAt;

    /** 更新时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
    private Date updatedAt;

    // 接收聚合后的图片字符串（数据库查询结果）
    private String productImagesStr;

    // 实际使用的图片数组（非数据库字段）
    private List<String> productImages;

    //支付方式
    private SuperPaymentMethod superPaymentMethod;

    /** 是否删除 0正常 1删除 */
    private Integer del;

    public SuperPaymentMethod getSuperPaymentMethod() {
        return superPaymentMethod;
    }

    public void setSuperPaymentMethod(SuperPaymentMethod superPaymentMethod) {
        this.superPaymentMethod = superPaymentMethod;
    }

    public String getProductImagesStr() {
        return productImagesStr;
    }

    public void setProductImagesStr(String productImagesStr) {
        this.productImagesStr = productImagesStr;
        // 将逗号分隔的字符串转换为 List 数组
        if (StringUtils.hasText(productImagesStr)) {
            this.productImages = Arrays.asList(productImagesStr.split(","));
        } else {
            this.productImages = new ArrayList<>();
        }
    }

    public List<String> getProductImages() {
        return productImages;
    }

    public void setProductImages(List<String> productImages) {
        this.productImages = productImages;
    }

    public Integer getTotalQuantity() {
        return totalQuantity;
    }

    public void setTotalQuantity(Integer totalQuantity) {
        this.totalQuantity = totalQuantity;
    }

    public void setId(Long id)
    {
        this.id = id;
    }

    public Long getId() 
    {
        return id;
    }

    public void setUserId(Long userId) 
    {
        this.userId = userId;
    }

    public Long getUserId() 
    {
        return userId;
    }

    public void setPayId(Long payId) 
    {
        this.payId = payId;
    }

    public Long getPayId() 
    {
        return payId;
    }

    public void setDeliveryId(Long deliveryId) 
    {
        this.deliveryId = deliveryId;
    }

    public Long getDeliveryId() 
    {
        return deliveryId;
    }

    public void setTotalAmount(BigDecimal totalAmount) 
    {
        this.totalAmount = totalAmount;
    }

    public BigDecimal getTotalAmount() 
    {
        return totalAmount;
    }

    public void setStatus(Integer status) 
    {
        this.status = status;
    }

    public Integer getStatus() 
    {
        return status;
    }

    public void setCreateAt(Date createAt) 
    {
        this.createAt = createAt;
    }

    public Date getCreateAt() 
    {
        return createAt;
    }

    public void setUpdatedAt(Date updatedAt) 
    {
        this.updatedAt = updatedAt;
    }

    public Date getUpdatedAt() 
    {
        return updatedAt;
    }

    public void setDel(Integer del) 
    {
        this.del = del;
    }

    public Integer getDel() 
    {
        return del;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
            .append("id", getId())
            .append("userId", getUserId())
            .append("payId", getPayId())
            .append("deliveryId", getDeliveryId())
            .append("totalAmount", getTotalAmount())
            .append("status", getStatus())
            .append("remark", getRemark())
            .append("createAt", getCreateAt())
            .append("updatedAt", getUpdatedAt())
            .append("del", getDel())
            .toString();
    }
}
